package com.example.springboot_demo2.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.PostConstruct;


@Controller
@ResponseBody  //加在类上,表示当前类中所有的方法返回的都是非静态页面的数据
public class TestController {


    //1.得到日志对象
    private static final Logger log = LoggerFactory.getLogger(TestController.class);

//    @Value("${student.name}")
//    private String name;


    @RequestMapping("/sayHi")
    public String sayHi() {
        log.trace("i am trace");
        log.debug("i an debug");
        log.info("i am info");
        log.warn("i an warn");
        log.error("i am error");
        return "hello word";
    }

//    @PostConstruct
//    public void doPostConstruct() {
//        System.out.println("name ->"+name);
//    }




}
